<?php require_once 'source.php';?>
<?php require_once 'config.php';?>
<?php require_once 'dao/dao_db.php';?>
<?php require_once 'dao/dao_weekly_report.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SYSTITLE?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="wrapper">
<?php require_once 'header.php';?>
<div id="layout">
	<div id="leftlay"><?php require_once 'leftnav.php';?></div>
	<div id="rightlay">
		<div class="columntitle"><?php echo WEEKLYREPORT?></div>
		<div class="columncontent">
			<div id="weeklyreport">
			<?php 	
				if($_SESSION['userid']!=''){
					$reportid=$_GET['id'];
					$result=get_report($reportid);
					mysql_close();
				}
				if(mysql_num_rows($result)!=0){
					if(($row=mysql_fetch_array($result))!=false){
			?>
				<h3>
				<?php 
					if($row['REPORTTITLE']){
						echo $row['REPORTDATE'].'['.$row['REPORTTITLE'].']';
					}else{
						echo $row['REPORTDATE'];
					}
				?>
				</h3>
				<h4><?php echo $row['USERNAME']?></h4>
				<hr/>
				<p><?php echo nl2br($row['CONTENT'])?></p>
			<?php 
					}
				}else{
					echo NOREPORT;
				}				
			?>
			<hr/>
			
				<?php 
					if($row['COMMENT']!=''){
				?>
				<div id="cmt"><?php echo nl2br($row['COMMENT'])?></div>
				<?php 
					}if($_SESSION['level']==TEACHER){
				?>
			<form action="service/service_weekly_report.php" method="post">
			<div id="comment">
				<textarea rows="5" name="comment"></textarea>
				<input type="submit" value="<?php echo SUBMIT?>"/>
				<input type="hidden" name="titleid" value="<?php echo $row['Id']?>"/>
			</div>
			</form>
			<?php }?>
			</div>
		</div>
	</div>
</div>
</div>
</body>
</html>
